﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;

namespace GoodroommateComputingPlatform
{
    public class Program
    {
        public static IConfigurationRoot Configuration { get; set; }

        private static Dictionary<string, string> defaultConfiguration = new Dictionary<string, string>()
        {
            {"server.urls", "http://localhost:6001" }
        };

        public static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                .AddInMemoryCollection(defaultConfiguration)
                .AddEnvironmentVariables()
                .AddCommandLine(args);
            Configuration = builder.Build();

            var host = new WebHostBuilder()
                .UseKestrel()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()
                .UseStartup<Startup>()
                .UseConfiguration(Configuration)
                .Build();

            host.Run();
        }
    }
}
